<?php 
include '../functions.php';
// 链接数据库
$mysqli = @new mysqli("localhost", "root", "", "school");


if($mysqli->connect_errno){
	exit("错误代码：".$mysqli->connect_errno."错误信息".$mysqli->connect_error);
}


$mysqli->query("set names utf8");


// 预准备语句
$sql = "insert into stu (name,age,sex) values(?,?,?)";
//预准
$stmt = $mysqli->prepare($sql);

if($stmt){

	// 绑定参数
	$stmt->bind_param('sis', $name, $age, $sex);

	for ($i=0; $i <100 ; $i++) { 
		
		$name = "小马马".$i;

		$age = 90;

		$sex = '男';

		$stmt->execute();
	}
}







// // $sql = "update stu set age=40 where name='小花'";


// // $sql = "delete from stu where name ='小马'";

// for ($i=0; $i <1000 ; $i++) {
// 	$sql = "insert into stu (name,age,sex) values('小马".$i."',18,'男')"; 
// 	$res = $mysqli->query($sql);
// }
 ?>